{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Stacked Bar Chart\n",
    "-----------------\n",
    "\n",
    "This example shows how to make a stacked bar chart of the weather type in Seattle from 2012 to 2015 by month.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from vega_datasets import data\n",
    "\n",
    "weather = data.seattle_weather()\n",
    "\n",
    "alt.Chart(weather).mark_bar().encode(\n",
    "    alt.Color('weather:N',\n",
    "        legend=alt.Legend(title='Weather type'),\n",
    "        scale=alt.Scale(\n",
    "            domain=['sun', 'fog', 'drizzle', 'rain', 'snow'],\n",
    "            range=['#e7ba42', '#c7c7c7', '#aec7e8', '#1f77b4', '#9467bd']\n",
    "        ),\n",
    "    ),\n",
    "    alt.X('date:N',\n",
    "        axis=alt.Axis(title='Month of the Year'),\n",
    "        timeUnit='month',\n",
    "    ),\n",
    "    y='count()',\n",
    ")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
